<template name="ThreadHeader">
  {{> InboxBackButton}}
  {{#if showDetails}}{{> InboxSidebarButton}}{{/if}}

  <div class="thread-subject">{{threadTitle this}}</div>
</template>

<template name="ThreadMenu">
  <div class="btn-group btn-group-justified" id="thread-menu">
    {{#each actions}}
      <a href="#" class="btn btn-default btn-action">
        <i class="{{menuIcon}} text-muted"></i>
        <span class="text-muted">{{menuTitle}}</span>
      </a>
    {{/each}}
  </div>
</template>

<template name="Thread">
  {{#if actions.length}}
    {{> ThreadMenu}}
  {{/if}}
  {{#if threadCanReply this}}
    {{> MessageForm thread=this options=true}}
  {{else}}
    <div class="text-muted text-center" id="thread-noreply-info">
      <span>{{_ "email_state_noreply"}}</span>
    </div>
  {{/if}}

  <div class="messages">
    {{#each messages}}
      {{> Template.dynamic template=messageTemplate}}
    {{/each}}
    {{#if ready}}
      {{#if hasMore}}
        <div class="message text-center">
          <a href="#" class="text-muted small btn-load-more">
            {{_ "paginate_load_more"}}
          </a>
        </div>
      {{/if}}
    {{else}}
      <div class="message text-center">
        <i class="fa fa-spinner fa-spin text-muted small"></i>
      </div>
    {{/if}}
  </div>
</template>
